package com.witframework.dynoengine.render.form;

import com.witframework.dynoengine.render.formater.DefaultCellFormat;
import com.witframework.util.StringTools;


public class InputRender extends FormFieldRender{
	
	public String render() {	
		String type=(String)getParameter(super.PARAM_type);	
		html.input("text").name((String)getParameter(super.PARAM_name));
		if(type!=null) html.readonly();
		html.size(String.valueOf(getParameter(super.PARAM_size)));
		html.value(new DefaultCellFormat().parse(getParameter(super.PARAM_value)));
		if(!StringTools.parseBoolean((String)getParameter(super.PARAM_editable))) html.readonly();
		String tooltipText=(String)getParameter(super.PARAM_tiptext);
		html.append(" tooltipText=\""+(tooltipText==null?"":tooltipText)+"\"");
		String validation=(String)getParameter(super.PARAM_validation);
		html.append(" class=\""+(validation==null?"":validation)+"\"");
		html.close();
		return html.toString();
	}

}
